﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Innova.Entites;
using Innova.BusinessLogic;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace Innova.Movil.Controllers
{
    public class CategoriaController : Controller
    {
        public CategoriaController()
        {
        }

        [Dependency]
        public ICategoriaBL catBL { get; set; }

        [Dependency]
        public IPatrocinadorBL patroBL { get; set; }

        public ActionResult Index()
        {
            var categorias = catBL.GetFromCategoriaByDescripcion("");
            return View(categorias);
        }

        [HttpPost]
        public ActionResult Index(string criterio = "")
        {
            var categorias = catBL.GetFromCategoriaByDescripcion(criterio);
            return View(categorias);
        }


        public ActionResult GetFotoCategoria(Int32 id)
        {
            var cat = catBL.GetFotoByCategoriaId(id);

            return File(cat, "image/jpeg", "Nombre"+ ".jpg");


        }

    }
}
